﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Runtime.Serialization;
using System.Runtime.CompilerServices;

namespace LunchRoller.ViewModels
{
    [DataContract]
    public class PersonModel : ViewModelBase
    {

        [DataMember]
        public
            PropertyContainer<String> _Name
            = new PropertyContainer<String>("Name", "");

        public String Name
        {
            get { return _Name.Value; }
            set 
            {
                if (string.IsNullOrEmpty(value))
                {
                    value = "-";
                }
                _Name.SetValueAndTryNotify(this, value); 
            
            }
        }

        Visibility _ChosenVisibility = Visibility.Collapsed;

        public Visibility ChosenVisibility
        {
            get
            {
                return Chosen ? Visibility.Visible : Visibility.Collapsed;
            }
            private set
            {
                _ChosenVisibility = value;
                base.RaisePropertyChanged("ChosenVisibility");
            }
        }
        //PropertyContainer<String> _Mail
        //    = new  PropertyContainer<String>("Mail", "");
        //public String Mail
        //{
        //    get { return _Mail.Value; }
        //    set { _Mail.SetValueAndTryNotify(this, value); }
        //}



	[DataMember]
        public PropertyContainer<String> _Phone
            = new  PropertyContainer<String>("Phone", "");
        public String Phone
        {
            get { return _Phone.Value; }
            set { _Phone.SetValueAndTryNotify(this, value); }
        }

        public MainViewModel MainViewModel { get { return App.ViewModel; } }


        bool _Chosen = true;
        [DataMember]
        public bool Chosen
        {
            get
            {
                return _Chosen;
            }
            set
            {
                _Chosen = value;
                base.RaisePropertyChanged("Chosen");
                ChosenVisibility = value ? Visibility.Visible : Visibility.Collapsed; 
            }
        }



        bool _IsAdding = true;

        public bool IsAdding
        {
            get
            {
                return _IsAdding;
            }
            set
            {
                _IsAdding = value;
                base.RaisePropertyChanged("IsAdding");
            }
        }

        
    }
}
